package hc.bre.clas

import hc.bre.clas.range.RangeDefinition
import hc.bre.clas.range.RangeOption


@groovy.transform.TypeChecked
class Class9ExcelBuilder {

	static	ArrayList<ArrayList<String>> readExcel(String fileName) {

		hc.util.ExcelUtil.readExcelFixedWidth(fileName, 'Variable Classification', 3)
	}

	static RangeDefinition table2Definition(ArrayList<ArrayList<String>> excelTable) {
		def def7 = new RangeDefinition();
		def7.list =[];
		def7.rname= excelTable[0][1]
		def7.variableId = Integer.parseInt(excelTable[1][1]);

		for(int i = 3; i < excelTable.size();i ++) {

			def row = excelTable[i]

			def seg = new RangeOption()
			seg.name = row[0]
			seg.range = row[1]
			seg.id = Integer.parseInt(row[2])

			def7.list.add(seg)
		}

		def7
	}
}
